package com.comiee.airwalker

import com.comiee.airwalker.common.CommonProxy
import net.minecraftforge.fluids.FluidRegistry
import net.minecraftforge.fml.common.Mod.EventHandler
import net.minecraftforge.fml.common.event._
import net.minecraftforge.fml.common.{Mod, SidedProxy}
import org.apache.logging.log4j.Logger


/**
 * @author comiee
 */
@Mod(modid = AirWalkerMod.MODID, name = AirWalkerMod.NAME, version = AirWalkerMod.VERSION, modLanguage = "scala")
object AirWalkerMod {
  final val MODID = "air_walker"
  final val NAME = "Air Walker"
  final val VERSION = "1.0.0"

  @SidedProxy(
    clientSide = "com.comiee.airwalker.client.ClientProxy",
    serverSide = "com.comiee.airwalker.common.CommonProxy"
  )
  var proxy: CommonProxy = _

  var logger: Logger = _

  FluidRegistry.enableUniversalBucket() //启用通用流体桶

  /** 在所有Mod初始化之前调用，这时候应该加载配置文件，实例化物品和方块，并注册它们 */
  @EventHandler
  def preInit(event: FMLPreInitializationEvent): Unit = proxy.preInit(event)

  /** 用于该Mod的初始化，这时候应该为Mod进行设置，如注册合成表和烧炼系统，并且向其他Mod发送交互信息 */
  @EventHandler
  def init(event: FMLInitializationEvent): Unit = proxy.init(event)

  /** 在所有Mod都初始化之后调用，这时候应该接收其他Mod发送的交互信息，并完成对Mod的设置 */
  @EventHandler
  def postInit(event: FMLPostInitializationEvent): Unit = proxy.postInit(event)

  /** 服务端启动前触发 */
  @EventHandler
  def serverStarting(event: FMLServerStartingEvent): Unit = proxy.serverStarting(event)

  /** 服务端关闭前触发 */
  @EventHandler
  def serverStopping(event: FMLServerStoppingEvent): Unit = proxy.serverStopping(event)
}